<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../css/bootstrap.css">
    <title>表单校验</title>
</head>
<body>
    <div class="container">
        <!-- .was-validated开启boostrap的表单校验，表单会在一加载就校验 -->
        <form class="was-validated">
            <div class="form-group">
                <label >用户名</label>
                <input type="text" class="form-control" placeholder="用户名" required>
                <!-- 校验的提示文字用div装， -->
                <!-- .valid-feedback是校验通过 -->
                <!-- .invalid-feedback是校验失败 -->
                <div class="valid-feedback">通过</div>
                <div class="invalid-feedback">请填写用户名</div>
            </div>
            <div class="form-group">
                <label >密码</label>
                <input type="password" class="form-control" placeholder="密码" required>
                <div class="valid-feedback">通过</div>
                <div class="invalid-feedback">请填写密码</div>
            </div>
            <div class="form-group form-check">
                <label class="form-check-lable">
                  <input type="checkbox" class="form-check-input" required>我同意条款
                  <div class="valid-feedback">通过</div>
                <div class="invalid-feedback">必须同意条款才能进行登录</div>
                </label>
            </div>
            <button type="submit" class="btn btn-primary">登录</button>
        </form>
    </div>
</body>
</html>